int cmp(int* x, int* y)
{
    return *x - *y;
}

int* sortedSquares(int* nums, int numsSize, int* returnSize) {
    int* a = (int*)malloc(sizeof(int) * numsSize);
    *returnSize = numsSize;
    for (int i = 0; i < numsSize; i++)
    {
        a[i] = nums[i] * nums[i];
    }
    qsort(a, numsSize, sizeof(int), cmp);
    return a;
}